<template>
	<view>
		<view class="selectClass">
			<view>角块是否保持色向借位</view>
			<switch :checked="cornerIsKeep" @change="changeC_j(); "></switch>
		</view>
		
		<prettyChange :list="cornerLendList" :S="cornerS" @change="sortChange"></prettyChange>
	</view>
	
</template>

<script>
	import constant from '../../utils/constant';
	import storage from "../../utils/storage";
	import prettyChange from '../../components/pretty-exchange/pretty-exchange.vue'
	export default {
		components: {
		            prettyChange
		        },
		data() {
			return {
				cornerLendList: [],
				itemHeight: 90,
				cornerIsKeep:true,
				cornerS:[]
			};
		},
		onLoad() {
			var cornerLend = constant.getCornerLend();
			this.cornerIsKeep = constant.getCornerIsKeep();
			this.cornerLendList = Array.from(constant.getCornerLendShow(cornerLend));
			this.cornerS= constant.getCornerS();
		},
		methods:{
			sortChange(cornerLendList){
				var res = [];
				for(var i = 0;i<cornerLendList.length;i++){
					res.push(cornerLendList[i].value);
				}
			    storage.setStorageSync('cornerLend',res);
				uni.$emit('update');
			},
			changeC_j(){
				this.cornerIsKeep = !this.cornerIsKeep;
				storage.setStorageSync('cornerIsKeep',this.cornerIsKeep);
				uni.$emit('update');
			},
			
						
		}
	}
</script>

<style lang="scss">
	.selectClass {
		margin: 10rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
	}
//scoped 在当前页生效 不影响子组件
	.drag-item{
		flex-direction: column;
		display: flex;
		align-items: center;
	}
</style>
